/***********************************************************************
 * Module:  Fidele.java
 * Author:  noelLodou
 * Purpose: Defines the Class Fidele
 ***********************************************************************/

package Modele;

import java.util.*;

/** @pdOid 962c84d5-cb86-4b96-824a-3e2f09e2a777 */
public class Fidele extends Client {
   /** @pdOid 9afbc136-2c04-4711-b07c-48d863e87cc1 */
   private int pointFidelite;
   
   /** @pdRoleInfo migr=no name=Urgent assc=association10 coll=java.util.Collection impl=java.util.HashSet mult=0..* */
   public ArrayList<Urgent> urgent;
   
   public Fidele(int numero, String nom, String adresse) {
		super(numero, nom, adresse);
		this.pointFidelite = 0;
	}
   
   /** @pdOid bd9a7e35-b83f-45ac-9595-c4d4e26cfde2 */
   public int augmenterPoints(float montantExpedition) {
      int point = (int) montantExpedition / 100;
      
      this.pointFidelite += point;
      return (point);
   }
   
  
   
   public int getPointFidelite() {
	return pointFidelite;
}


public void setPointFidelite(int pointFidelite) {
	this.pointFidelite = pointFidelite;
}


public void demandeExpedition(Personne destinataire, ArrayList<Colis> c, boolean urgent) {
	// TODO Auto-generated method stub
	   if (urgent == false)
		   super.demandeExpedition(destinataire, c);
	   else
	   {
		   Expedition e = new Urgent(this, destinataire, c);
		   this.urgent.add((Urgent) e);
	   }
}
/** @pdGenerated default getter */
   public java.util.Collection<Urgent> getUrgent() {
      if (urgent == null)
         urgent = new ArrayList<Urgent>();
      return urgent;
   }
   
   /** @pdGenerated default iterator getter */
   public java.util.Iterator getIteratorUrgent() {
      if (urgent == null)
         urgent = new ArrayList<Urgent>();
      return urgent.iterator();
   }
   
   /** @pdGenerated default setter
     * @param newUrgent */
   public void setUrgent(java.util.Collection<Urgent> newUrgent) {
      removeAllUrgent();
      for (java.util.Iterator iter = newUrgent.iterator(); iter.hasNext();)
         addUrgent((Urgent)iter.next());
   }
   
   /** @pdGenerated default add
     * @param newUrgent */
   public void addUrgent(Urgent newUrgent) {
      if (newUrgent == null)
         return;
      if (this.urgent == null)
         this.urgent = new ArrayList<Urgent>();
      if (!this.urgent.contains(newUrgent))
         this.urgent.add(newUrgent);
   }
   
   /** @pdGenerated default remove
     * @param oldUrgent */
   public void removeUrgent(Urgent oldUrgent) {
      if (oldUrgent == null)
         return;
      if (this.urgent != null)
         if (this.urgent.contains(oldUrgent))
            this.urgent.remove(oldUrgent);
   }
   
   /** @pdGenerated default removeAll */
   public void removeAllUrgent() {
      if (urgent != null)
         urgent.clear();
   }

}